<template>
  <div>
       <van-nav-bar
         left-arrow
        class="app-nav-bar"
        title="事件驳回"
        @click-left="$router.back()"
      />
        <van-form @submit="onSubmit">
           
            <van-field
                v-model="rejectDesc"
                label="驳回理由:"
                placeholder="请输入驳回理由"
            />
            <div style="margin:16px">
                <van-button round block type="info" native-type="submit">提交</van-button>
            </div>
        </van-form>
  </div>
</template>

<script>
export default {
    name:'reject',
    data(){
        return{
            rejectDesc:''
        }
    },
    methods:{
        async onSubmit(){
            var {data:res} = await this.$axios({
                url:this.$location.rejectEvent,
                method:'get',
                params:{
                    id:this.$route.params.id,
                    rejectDesc:this.rejectDesc
                }
            })
            console.log(res);
             if(res.status==200){
                this.$toast.success(res.msg)
                 this.$router.push('/event');
            }else{
                this.$toast.fail(res.msg)
                 this.$router.push('/event');
            }
        }
    },
    created(){
        // console.log(this.$route.params.id)
    }
}
</script>

<style lang="less" scoped>
 /deep/ .app-nav-bar{
        background-color: #3296fa;
        .van-nav-bar__title{
            color: #fff;
        }
        .van-icon{
            color: #fff;
        }
    }
</style>